package com.dede.getmusic.extends.kson

import org.json.JSONException
import org.json.JSONObject

/**
 * @author hsh
 * @date 2017/9/29 17:16.
 * @doc
 */

fun String.getString(key: String): String {
    return try {
        val jsonObject = JSONObject(this)
        if (jsonObject.has(key))
            jsonObject.getString(key)
        else
            ""
    } catch (e: JSONException) {
        ""
    }
}